import { homeStore } from '@/pinia/homeStore.ts';

/** 路径配置 */
let reqUrl = '';//本地环境配置
if (window.location.href.indexOf('dev1') != -1 ) {
  reqUrl = 'dev1';
} else if (window.location.href.indexOf('sit2') != -1) {
  reqUrl = 'sit2';
}  else if (window.location.href.indexOf('sit5') != -1) {
  reqUrl = 'sit5';
}else if (window.location.href.indexOf('sit6') != -1) {
  reqUrl = 'sit6';
}else if (window.location.href.indexOf('sit7') != -1) {
  reqUrl = 'sit7';
}else if (window.location.href.indexOf('sit8') != -1) {
  reqUrl = 'sit8';
}else if (window.location.href.indexOf('perf1') != -1) {
  reqUrl = 'perf1';
}

// 图片上传在本地要加bmp/，部署在服务器上时不用加，服务器上自己有
// 线上
let fileUrl = `../../${reqUrl}/manage-upload/normal/bmp-manage/`;
let dataUrl = `../../${reqUrl}/manage-api/normal/bmp-manage/`
// 本地启动
if(window.location.origin.indexOf('localhost') != -1 || window.location.origin.indexOf('127.0.0.1') != -1) {
  fileUrl = `/manage-upload/normal/bmp-manage/`;
  dataUrl = `/manage-api/normal/bmp-manage/`;
}


/** 公用定义参数 */
const common = {
  dialogMaxHeight: '60vh',
  reqUrl: reqUrl,
  fileUrl:  fileUrl,
  dataUrl: dataUrl,
  // 密码正则判断（大、小写字母，数字，特殊字符应至少包含两类，密码长度8位以上）
  passwordPass: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{8,20}$/,
  passwordMsg: "请输入正确的密码格式，密码要求必须包含8-16位数字、字符、字母（区分大小写）",
  passwordDifferent: "您两次输入的新密码不一致,请重新输入",
  // 金额判断
  moneyPass: /^[0-9]*(\.[0-9]{1,2})?$/,
  // 数字判断
  numberPass: /^[0-9]*$/,
  // 手机号判断
  phonePass: /^1\d{10}$/,
  // 邮箱判断
  emailPass: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/,
  // 法人机构代码/社会统一信用代码判断
  legalCode: /^[0-9a-zA-Z]{3,}$/,
  // 身份证号
  cerNo: /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/,
};

export default common;
